using System;
using System.Collections.Generic;
using Dict.DataModel;

namespace Dict.Dao
{
    public class TableUnionFightNpcDao:DaoBase<TableUnionFightNpc>
    {
        public override void AddPrimaryIndex(TableUnionFightNpc model)
        {
            cachePrimary[model.UFNId.ToString()] = model;
        }

        public override string GetFileName()
        {
            return "TableUnionFightNpc.txt";
        }

        protected override TableUnionFightNpc ParseRowData(string[] rowData)
        {
            TableUnionFightNpc data = new TableUnionFightNpc();
			data.UFNId = rowData [0];

            if (string.IsNullOrEmpty(rowData[1]))
            {
                data.UFId = 0;
            }
            else
            {
                data.UFId = int.Parse(rowData[1]);
            }
			data.ModelRes = rowData [2];
			data.IconRes = rowData [3];

            if (string.IsNullOrEmpty(rowData[4]))
            {
                data.Height = 0;
            }
            else
            {
                data.Height = double.Parse(rowData[4]);
            }
			data.NPCName = rowData [5];
			data.WeaponId = rowData [6];
			data.Position = rowData [7];

            if (string.IsNullOrEmpty(rowData[8]))
            {
                data.Angle = 0;
            }
            else
            {
                data.Angle = int.Parse(rowData[8]);
            }

            if (string.IsNullOrEmpty(rowData[9]))
            {
                data.Camp = 0;
            }
            else
            {
                data.Camp = int.Parse(rowData[9]);
            }
			data.Building = rowData [10];

            if (string.IsNullOrEmpty(rowData[11]))
            {
                data.NeedRole = 0;
            }
            else
            {
                data.NeedRole = int.Parse(rowData[11]);
            }
			data.Url = rowData [12];

            return data;
        }


        public override void AddOneIndex(TableUnionFightNpc model)
        {
            if (!cacheOneIndex.ContainsKey(model.UFId.ToString()))
            {
                cacheOneIndex[model.UFId.ToString()] = new List<TableUnionFightNpc>();
            }
            cacheOneIndex[model.UFId.ToString()].Add(model);
        }
    

    }

}
